<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>补签记录</title>
	<link rel="stylesheet" href="../css/common2.css">
	<link rel="stylesheet" href="../css/motai3.css">
	<link rel="stylesheet" href="/scriptZIP/vue-select.min.css">
	<style>
		.search_img {
			position: absolute;
			margin-top: -30px;
			right: 3%;
		}

		[v-if] {
			display: none;
		}

		.modal-data5,
		.modal-content5 {
			min-height: unset;
			height: unset;
		}

		.modal-content5 .layui-input {
			width: 50%;
			margin: 0 auto;
		}

		.other {
			margin-top: -30px;
			height: 33px;
			max-width: 120px;
			width: 15vw;
			height: 35px;
			padding-left: 20px;
			font-size: 14px;
			color: #686868;
			position: absolute;
			border: 1px solid;
			display: inline-block;
		}
		
		.long-background-img {
			width: 120px;
			height: 35px;
			background: url("../image/enter_longer.png") no-repeat center center !important;
		}
	</style>
</head>

<body>

	<div id="vue-root">
		<div class="href_head" style="margin-top: 60px;">
			<div class="refresh action-buttons" onclick="location.reload()">刷新</div>
			<input class="other" placeholder="请输入姓名" v-model="search.name" @keyup.enter="getData0"
				style="position: absolute; right: 420px; margin-top: 4px;">
			<div class="chooses">
				<select class="classes search" v-model="search.classesId"
					style="position: absolute; right: 260px; margin-top: -30px;">
					<option :value="undefined">请选择班级</option>
					<option v-for="classes in classess" :key="classes.id" :value="classes.id" v-text="classes.name">
					</option>
				</select>
			</div>
			<!-- <div class="chooses">
				<select class="states search" v-model="search.status"
					style="position: absolute; right: 100px; margin-top: -80px;">
					<option :value="undefined">请选择审核状态</option>
					<option :value="0">未审核</option>
					<option :value="1">已通过</option>
					<option :value="2">已驳回</option>
				</select>
			</div> -->
		</div>
		<input placeholder="开始时间" class="other" v-model="search.startTime" id="startTime"
			style="width: 64px;font-size:12px;position: absolute; right: 170px;padding-left: 5px;">
		<input placeholder="结束时间" class="other" v-model="search.endTime" id="endTime"
			style="width: 65px;font-size:12px;position: absolute; right: 100px; margin-top: -30px;padding-left: 5px;border-left: none;">
		<img src="../image/search.png" height="35" width="35" class="search_img" @click="getData0">

		<form enctype="multipart/form-data" id="form" ref="form" style="display: none;">
			<input type="file" name="file" id="file" @change="importExcel" ref="file"
				accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel">
		</form>
		<div class="table ">
			<table class="table_top">
				<thead>
					<tr>
						<th class="one">
							<input type="checkbox" class="check-box" v-model="all">序号
						</th>
						<th>姓名</th>
						<th>班级</th>
						<th>课程</th>
						<th>上课时间</th>
						<th>补签时间</th>
						<th>补签内容</th>
						<th>操作老师</th>
						<th>状态</th>
						<th v-if="able.del">删除</th>
					</tr>
				</thead>
				<tbody id="list">
					<tr v-for="(punch,index) in list" :key="punch.id">
						<td class="one">
							<input type="checkbox" class="check-box" v-model="punch.checked">
							<span v-text="index+1"></span>
						</td>
						<td v-text="punch.studentName"></td>
						<td v-text="punch.classesName"></td>
						<td v-text="punch.courseName"></td>
						<td v-text="punch.startTime"></td>
						<td v-text="punch.applyTime"></td>
						<td v-text="punch.reason"></td>
						<td v-text="punch.teacherName"></td>
						<td >补签</td>
						<!-- <td>
							<template v-if="punch.status==0">
								<button @click="audit(punch.id,true)">通过</button>
								<button @click="audit(punch.id,false)">驳回</button>
							</template>
							<template v-else>{{{1:'已通过',2:'未通过'}[punch.status]}}</template>
						</td> -->
						<td v-if="able.del">
							<div>
								<div class="delete-icon option-icon" @click="del([punch.id])">
									<img class="img" src="../image/delete.png" height="20" width="20"
										onmouseover="this.src='../image/delete_light.png'"
										onmouseout="this.src='../image/delete.png'" />
								</div>
							</div>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
		<br>
		<div class="delete" @click="batchDelete" v-if="able.del">批量删除</div>
		<div class="delete" v-if="able.export" @click="exports">批量导出</div>
		<div class="delete long-background-img"><a style="color: white;"
			href="/excel/批量补签模版.xlsx">下载导入模板</a></div>
			<label class="delete long-background-img" for="file" v-if="able.import">批量补签</label>

		<ul class="pagination" v-if="pages>1">
			<li>
				<a v-if="pageNum!=1" @click="pageNum=1">«</a>
				<a class="pages-jump" v-if="pageNum!=1" @click="pageNum--">‹</a>
				<a v-text="pageNum"></a>
				<a class="pages-jump" v-if="pageNum!=pages" @click="pageNum++">›</a>
				<a v-if="pageNum!=pages" @click="pageNum=pages">»</a>
			</li>
		</ul>
		<div style="float: right;">
			总共{{total}}条记录
			<select class="ui-select init" style="height:32px" v-model="pageSize">
				<option :value="10">每页10条</option>
				<option :value="30">每页30条</option>
				<option :value="100">每页100条</option>
			</select>
		</div>
	</div>

	<script src="/scriptZIP/qs.min.js"></script>
	<script src="/scriptZIP/vue.min.js"></script>
	<script src="/scriptZIP/axios.min.js"></script>
	<script src="/scriptZIP/vue-select.min.js"></script>
	<script src="/lib/laydate/laydate.js"></script>

	<script src="/js/common.js"></script>
	<script src="/js/list.js"></script>
	<script src="/js/auth_util.js"></script>

	<script>
		var app = new Vue(merge({
			data: {
				classess: [],
				urls: {
					del: '/pc/punch/del'
				},
				bigimg: false,
				big_src: null,
				show: false,
				date: null
			},
			created: function () {
				var schoolId = top_params().id;
				if (!schoolId) {
					alert('未知学校');
					throw '未知学校';
				}
				this.schoolId = schoolId;
				axios.get('/pc/classes/all/' + schoolId).then(function (res) {
					this.classess = res.data;
				}.bind(this));
				this.urls.list = '/pc/punch/list/' + schoolId;
				this.urls.imports = '/pc/attendanceRecord/importPunch/' +schoolId;
				this.getData();
				abled('punch', this);
			},
			methods: {
				getImg: function (pic) {
					if (!pic) return null;
					return '/static/' + this.schoolId + '/punch/' + pic;
				},
				bigImg: function (pic) {
					this.big_src = this.getImg(pic);
					this.bigimg = true;
				},
				exports: function () {
					var q = Qs.stringify(this.search);
					if (q) q = '?' + q;
					location.href = '/pc/punch/export/' + this.schoolId + q;
				},
				audit: function (id, passed) {
					if (!confirm('确认')) return;
					axios.put('/pc/punch/' + id + '?passed=' + passed).then(function (res) {
						this.getData();
					}.bind(this));
				}
			}
		}));

		laydate.render({
			elem: '#startTime',
			type: 'datetime',
			done: function (value, date, endDate) {
				app.search.startTime = value;
			}
		});

		laydate.render({
			elem: '#endTime',
			type: 'datetime',
			done: function (value, date, endDate) {
				app.search.endTime = value;
			}
		});
	</script>

</body>

</html>